#include "smart_pointer/pointer.h"

#include <iostream>

void testSharedPtr()
{
    std::shared_ptr<Node> node1 = std::make_shared<Node>(1);
    std::shared_ptr<Node> node2 = std::make_shared<Node>(2);

    node1->child = node2;
    node2->parent = node1;

    std::shared_ptr<Node> tmp = node2->parent.lock();
    if (tmp)
    {
        std::cout << tmp->data << std::endl;
    }
}

void testScene()
{
    std::shared_ptr<Node> node1 = std::make_shared<Node>(1);
    std::shared_ptr<Node> node11 = std::make_shared<Node>(2);

    node1->child = node11;
    node11->parent = node1;

    std::shared_ptr<Node> tmp = node11->parent.lock();
    if (tmp)
    {
        std::cout << tmp->data << std::endl;
    }

    std::shared_ptr<Scene> scene = std::make_shared<Scene>();
    scene->tree.insert({100, node1});
}